package com.dahua.messagesyncbj.controller;

import com.dahua.messagesyncbj.config.result.Exception.CommonException;
import com.dahua.messagesyncbj.config.result.ResultVO;
import com.dahua.messagesyncbj.pojo.EquipmentInfo;
import com.dahua.messagesyncbj.service.RedisService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
@RestController
@RequestMapping("/redis")
public class RedisController {
    @Resource
    private RedisService redisService;

    @PostMapping("/enquireEquipmentData")
    public ResultVO enquireEquipmentData(@RequestBody EquipmentInfo info){
        if (info.getName() == null){
            throw new CommonException("请求参数错误","设备名称不能为空");
        }
        return ResultVO.success(redisService.enquireEquipmentData(info));
    }
}
